package com.alfayun.fiscalriskanalysis.another.indicator;

import com.alfayun.fiscalriskanalysis.another.report.Report;
import com.alfayun.fiscalriskanalysis.another.specification.indicator.SelectorSpec;

import java.time.LocalDate;
import java.util.Collection;

public final class SingleSelector implements Selector {

	private SelectorSpec spec;

	private String name;

	private Report report;

	public SingleSelector(SelectorSpec spec, LocalDate startDate, String orgId) {

	}

	public SingleSelector(SelectorSpec spec) {
		this.spec = spec;
		this.name = spec.name;

	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public void bindReport(Collection<Report> reports) {
		reports.stream().filter(it -> spec.define.equals(it.getIndex())).findAny().ifPresent(it -> this.report = it);
	}

}
